import Cookies from 'js-cookie';

const user = {
	state: {
		userInfo: {
			userId: '',
			username: '',
			accessToken: '',
		}
	},
	mutations: {
		updateUserInfo(state,userInfo){
			state.userInfo.userId = userInfo.userId;
			state.userInfo.username = userInfo.username;
			state.userInfo.accessToken = userInfo.accessToken;
		},
		
		// logout (state) {
		// 	Cookies.remove('userInfo');
		// 	localStorage.clear();
		// 	state.userInfo.userId = '';
		// 	state.userInfo.username = '';
		// 	state.userInfo.accessToken = '';
		// }
	}
};

export default user;